from machine import Pin, SPI
import st7789py as st7789
import image as image

sck_pin = Pin(2, Pin.OUT)
mosi_pin = Pin(3, Pin.OUT)
spi = SPI(0, baudrate=40000000, polarity=1, phase=1, sck=sck_pin, mosi=mosi_pin)

backlight_pin = Pin(4, Pin.OUT)
reset_pin = Pin(5, Pin.OUT)
dc_pin = Pin(6, Pin.OUT)
cs_pin = Pin(1, Pin.OUT)
rotation_set = 3

tft = st7789.ST7789(
    spi,
    240,
    240,
    reset = reset_pin,
    cs = cs_pin,
    dc = dc_pin,
    backlight = backlight_pin,
    rotation = rotation_set)
    
#tft.fill(st7789.BLUE)
#tft.rect(0, 0, 100, 100, st7789.WHITE)
tft.bitmap(image, 0, 0)

#i = 0
#while True:
#    i = i - 1
#    tft.bitmap(image, i * 100, i * 100)
